@echo off
@echo Building help file using Sandcastle...
set project=MySpace Silverlight Kit
set ProductionTools=%ProgramFiles(x86)%\Sandcastle\ProductionTools\
set DXROOT=%ProgramFiles(x86)%\Sandcastle
set BinDir=..\MySpaceSilverlightKit\Bin\Debug\
set SLDir=%ProgramFiles(x86)%\Microsoft SDKs\Silverlight\v2.0\Reference Assemblies\
set path=%PATH%;%ProductionTools%;%ProgramFiles(x86)%\HTML Help Workshop
echo Step 1 - Error Level: %ERRORLEVEL%
"MRefBuilder" "%BinDir%MySpaceSilverlightKit.dll" /out:reflection.org /dep:"%SLDir%system.dll","%SLDir%System.Windows.dll","%SLDir%System.Net.dll","%SLDir%System.Core.dll","%SLDir%System.Xml.dll","%SLDir%System.Windows.Browser.dll"
if errorlevel==1 goto Exit
echo Step 2 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ApplyPrototypeDocModel.xsl" reflection.org /xsl:"%DXROOT%\ProductionTransforms\AddGuidFilenames.xsl" /out:reflection.xml
echo Step 3 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToManifest.xsl"  reflection.xml /out:manifest.xml 
echo Step 4 - Error Level: %ERRORLEVEL%
call "%DXROOT%\Presentation\Prototype\copyOutput.bat"
echo Step 5 - Error Level: %ERRORLEVEL%
BuildAssembler /config:sandcastle.config manifest.xml
echo Step 6 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToChmProject.xsl" reflection.xml /out:"Output\%project%.hhp" /arg:project="%project%"
echo Step 7 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\createPrototypetoc.xsl" reflection.xml /out:toc.xml /arg:project="%project%"
echo Step 8 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\TocToChmContents.xsl" toc.xml /out:"Output\%project%.hhc" /arg:project="%project%"
echo Step 9 - Error Level: %ERRORLEVEL%
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToChmIndex.xsl" reflection.xml /out:"Output\%project%.hhk"
echo Step 10 - Error Level: %ERRORLEVEL%
hhc "Output\%project%.hhp"
echo Completed - Error Level: %ERRORLEVEL%

:Exit
